﻿using System;
using System.Collections.Generic;
using System.Text;
using ECommerce.DAL;
using System.Data.SqlClient;
using System.Data;

namespace Entity
{
    [System.ComponentModel.DataObject]
    public class TblStateCountryExtended : TblStateCountry
    {
        public static CustomCollection<TblStateCountry> GetTblStateCountryByName(string Name)
        {
            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@StateCountryName", SqlDbType.NVarChar, 500, ParameterDirection.Input, Name  );
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SPR_TBL_STATE_COUNTRY_GET_STATE_COUNTRY_BY_NAME);
            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblStateCountryCollectionFromReader);
            CustomCollection<TblStateCountry> objCollection = ((CustomCollection<TblStateCountry>)ExecuteReaderCmd(sqlCmd, test));

            if (objCollection.Count > 0)
                return objCollection;
            else
                return null;
        }
        private const string SPR_TBL_STATE_COUNTRY_GET_STATE_COUNTRY_BY_NAME = "spr_tbl_state_country_get_state_country_by_name";
        
    }
}
